# 字典 dict
# 存储某个对象  —-->键：值（name：张三）

user = {
    'name' : '张三',
    'age' : 18,
    'gender' : '男'
}
print(user['name'])

print("----------")

# 新增
user['phone'] = '12345'
print(user)

print("----------")

# 修改
user['name'] = '李四'
print(user)

# 删除
user.pop('name')
print(user)

# 获取所有的键
print(user.keys())



print("----------")

# 字典嵌套
scores = {
    'zs':{'yw':50,'yy':60},
    'ls':{'yw':80,'yy':90}
}
print(scores['zs']['yy'])

# 列表 + 字典
num = [
    {'name' : '张三','age' : 18,'gender' : '男'},
    {'name' : '李四','age' : 20,'gender' : '女'}
]
print(num[0]['name'])


